///  rustc --crate-type=lib lib.rs 编译库
///

pub fn add(left: usize, right: usize) -> usize {
    left + right
}

pub fn public_function() {
    println!("called rary's `public_function()`");
}

fn private_function() {
    println!("called rary's `private_function()`");
}

pub fn indirect_access() {
    print!("called rary's `indirect_access()`, that\n> ");

    private_function();
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }

    #[test]
    fn test_private_function() {
        private_function();
    }
}

#[cfg(test)]
mod tests2 {
    use super::*;

    #[test]
    fn it_works() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }

    #[test]
    fn test_private_function() {
        private_function();
    }
}

#[test]
fn it_works_gg() {
    let result = 2 + 2;
    assert_eq!(result, 4);
}
